﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace Shop.Core.Redis
{
    public static class ServiceCollectionExtension
    {
        public static IServiceCollection AddRedisServices(this IServiceCollection services, RedisConfig config)
        {
            services.Configure<RedisConfig>(options => { options.ConnectionString = config.ConnectionString; });
            services.AddSingleton<IRedisProvider, RedisProvider>();
            return services;
        }
    }
}
